package com.park.web.md5;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Md5Util {
  public static  String md5decode(String resource){
      String result ="";
      try {
          MessageDigest md = MessageDigest.getInstance("MD5");
          md.update(resource.getBytes());
          byte b[] = md.digest();
          int i;
          StringBuffer buf = new StringBuffer("");
          for (int offset = 0; offset < b.length; offset++) {
              i = b[offset];
              if (i < 0)
                  i += 256;
              if (i < 16)
                  buf.append("0");
              buf.append(Integer.toHexString(i));
          }
          result = buf.toString();
      }catch (NoSuchAlgorithmException ex){
          return "";
      }
      return result;
  }
}
